Add Touch Screen Driver


1. Add Touch Screen Driver File

Touch driver belongs to the input subsystem, which provided by the manufacturer. After the driver is successfully loaded, it will be stored in /dev/input/eventX (if there is no other input subsystem, event0 will be generated).

  1. Add the linux driver provided by the IC manufacturer to kernel/drivers/input/touchscreen/.

  2. Add driver file link in kernel/drivers/input/touchscreen/Makefile, and use CONFIG_TOUCHSCREEN_GOODIX to control.

  3. Add CONFIG_TOUCHSCREEN_GOODIX in kernel/drivers/input/touchscreen/Kconfig to add make menuconfig in the kernel config.


2. Add Touch Screen device Tree Node

Add device tree nodes according to the driver and hardware connection diagram provided by the IC manufacturer for the driver to obtain and use.

Config required for common device trees:

  1. Configure the compatible name of the device tree node according to the name used by the driver

  2. Configure the I2c slave addr for touch IC

  3. Configure the RST/Interrupts pin connecting the touch IC and the main chip


3. Sample

Take the Goodix driver in evaluation board as an example.

Open kernel/arch/arm/boot/dts/infinity2m-ssc011a-s01a-display.dtsi (Please add to the dtsi of the project according to actual use).

  1. According to the hardware connection, the Goodix device tree node is i2c-group = 1, using i2c mode1.

  2. Create goodix_gt911@5D, compatible = "goodix, gt911" (compatible name needs to match the driver).

  3. According to the I2C slave addr provided by the touch IC manufacturer, configure the reg attribute. The goodix I2C slave addr here is 0x5D (requires confirmation from the IC manufacturer).

  4. The device tree node configures the pins of goodix_rst/goodix_int according to the hardware connection (the attribute name needs to match the driver).

Note: It is better to have only one touch device. After adding other touch devices, please disable the default Goodix driver of the evaluation board in config.